<div class="col-lg-12">
    <h1 class="page-header">Danh sách email nhận tin</h1>
</div>
<?php
$formInsert = $this->beginWidget('booster.widgets.TbActiveForm', array(
            'id' => 'verticalForms',
            'htmlOptions' => array(), // for inset effect
        ));
?>
<div class="col-lg-6">
    <?php
    echo $formInsert->textFieldGroup($email, 'email');
    echo $formInsert->dropDownListGroup(
                $email, 'gender', array(
                'widgetOptions' => array(
                    'data' => getGender(),
                    'default' => 0,
                )
            ));
    
    ?>
    <input  value="Thêm email" class="btn btn-danger" type="submit"/>
    <br/><br/>
</div>
<?php $this->endWidget(); ?>
<div class="col-lg-12">

    <table class="items table table-bordered">
        <tr style="background: #428bca;color: #fff">
            <th width="100px">#</th>
            <th>email</th>
            <th>Giới tính</th>
            <th>ngày đăng ký</th>
            <th style="text-align: center">xóa</th>
        </tr>
        <?php
        $form = $this->beginWidget('booster.widgets.TbActiveForm', array(
                    'id' => 'verticalForm',
                    'method' => 'get',
                    'htmlOptions' => array('method' => 'get'), // for inset effect
                ));
        ?>
        <tr>
            <td></td>
            <td>
                <?php
                echo $form->textFieldGroup($search, 'email', array('labelOptions' => array("label" => false)));
                ?>
            </td>
            <td>
                <?php
                $gender = getGender();
                $gender['0'] = 'tất cả';
                ksort($gender);
                echo $form->dropDownListGroup(
                        $search, 'gender', array(
                    'labelOptions' => array("label" => false),
                    'widgetOptions' => array(
                        'data' => $gender,
                        'default' => 0,
                    )
                        )
                );
                ?>
            </td>
            <td></td>
            <td style="text-align: center">
                <input  value="tìm kiếm" class="btn btn-danger" type="submit"/>
            </td>
        </tr>
        <?php $this->endWidget(); ?>
        <?php foreach ($emails as $mail): ?>
            <tr>
                <td>
                    <?php echo $mail->id ?>
                </td>
                <td>
                    <?php echo $mail->email ?>
                </td>
                <td>
                    <?php
                    $genders = getGender();
                    echo $genders[$mail->gender];
                    ?>
                </td>
                <td>
                    <?php echo date('d-m-Y', strtotime($mail->created)) ?>
                </td>
                <td style="text-align: center">
                    <a class="delete" title="" data-toggle="tooltip" href="<?php echo Yii::app()->createUrl('email/delete', array('id' => $mail->id)) ?>" data-original-title="Delete">
                        <i class="glyphicon glyphicon-trash"></i>
                    </a>
                </td>
            </tr>
        <?php endforeach; ?>
    </table>

</div>
